// 在这里面定义所有接口，一个文件管理所有接口，易于维护
import {
  http
} from '../lgApi/http'; // 引入刚刚封装好的http模块，import属于ES6的语法，微信开发者工具必须打开ES6转ES5选项
const config = require("../lgApi/config")

// function test(params){ // test
//   http('/info/api/v3/carousel/list','get',params)  // 接口请求的路由地址以及请求方法在此处传递
// }

module.exports = { // 暴露接口
  // 获取微信手机号
  getPhoneNumber: function (code) {
    return http({
      url: `/user/api/v2/wechat/miniapp/getPhoneNumber/${code}`,
      method: 'get'
    })
  },
  // 小程序通过微信 openid登录或注册
  login: function (data) {
    return http({
      url: `/user/api/v2/wechat/miniapp/login/openid`,
      method: 'post',
      data
    })
  },
  // 小程序通过微信 openid登录或注册
  getOpenid: function (code) {
    return http({
      url: `/user/api/v2/wechat/miniapp/openid`,
      method: 'post',
      data: {
        code
      }
    })
  },
  // 查询轮播图信息及图片
  getCarouselInfoMP: function () {
    return http({
      url: `/laborer/api/v2/oddJob/carousel/getCarouselInfoMP`,
      method: 'get'
    })
  },
  // 获取服务行业-首界面
  getLaborerList: function (data) {
    return http({
      url: `/laborer/api/v2/pc/oddjob/getLaborerList`,
      method: 'post',
      data
    })
  },
  // 区域查询，根据层级数返回区域树，默认返回省市县三级
  findRegionTree: function (id) {
    return http({
      url: `/laborer/api/v2/basicRegion/findRegionTree/${id}`,
      method: 'get'
    })
  },
  // 获取当前用户信息，包含角色，资源
  getUserInfo: function () {
    return http({
      url: `/user/api/v2/users/info/authority`,
      method: 'get'
    })
  },
  // 用户实名认证
  authInfo: function (data) {
    return http({
      url: `/user/api/v2/users/authInfo`,
      method: 'post',
      data
    })
  },
  // 获取手机验证码
  getPhoneCode: function (data) {
    return http({
      url: `/user/api/v2/wechat/miniapp/verCode`,
      method: 'post',
      data
    })
  },
  // 小程序首页列表
  indexPosiitionList: function (status, areaCode) {
    return http({
      url: `/laborer/api/v2/mini/oddJob/indexPosiitionList?status=${status}&areaCode=${areaCode}`,
      method: 'get'
    })
  },
  // 区域查询，根据中文查询区域编码
  findRegionCodeByName: function (data) {
    return http({
      url: `/laborer/api/v2/basicRegion/findRegionCodeByName`,
      method: 'post',
      data
    })
  },
  // 获取手机验证码
  consumerList: function (data) {
    return http({
      url: `/laborer/api/mini/delivery/consumerList`,
      method: 'post',
      data
    })
  },
  // 邀请记录
  inviteConsumerList: function (params) {
    return http({
      url: `/laborer/api/mini/invite/inviteConsumerList`,
      method: 'get',
      params
    })
  },
  // 收到邀请
  inviteJobList: function (params) {
    return http({
      url: `/laborer/api/mini/invite/inviteJobList`,
      method: 'get',
      params
    })
  },
  // 收到报名
  providerList: function (data) {
    return http({
      url: `/laborer/api/mini/delivery/providerList`,
      method: 'post',
      data
    })
  },
  // 零工列表
  getJobList: function (data) {
    return http({
      url: `/laborer/api/v2/mini/oddJob/miniList`,
      method: 'post',
      data
    })
  },
  // 获取字典
  getDictionaryType: function (type) {
    return http({
      url: `/laborer/api/v2/dictionary`,
      method: 'get',
      params: {
        type
      }
    })
  },
  // 查询所有零工类型
  getJobType: function () {
    return http({
      url: `/laborer/api/v2/mini/oddJob/mini/getAllTypes`,
      method: 'get'
    })
  },
  // 零工详情
  getJobDetail: function (params) {
    return http({
      url: `/laborer/api/v2/mini/oddJob/info`,
      method: 'get',
      params
    })
  },
  // 分享
  shareJob: function (id) {
    return http({
      url: `/laborer/api/v2/mini/oddJob/share/${id}`,
      method: 'post'
    })
  },
  // 职位沟通
  openRoom: function (data) {
    return http({
      url: `/laborer/api/chat/openRoom`,
      method: 'post',
      data
    })
  },
  // 加载聊天室
  loadChatRoom: function (data) {
    return http({
      url: `/laborer/api/chat/loadChatRoom/${data.roomId}`,
      method: 'get',
      data
    })
  },
  // 接单方投递零工
  delivery: function (id) {
    return http({
      url: `/laborer/api/mini/delivery/${id}`,
      method: 'post'
    })
  },
   // 判断当前用户是否收藏零工职位
   getCollectStatus: function (params) {
    return http({
      url: `/laborer/api/v2/mini/oddJob/checkCollect`,
      method: 'get',
      params
    })
  },
  // 收藏零工
   collectJob: function (data) {
    return http({
      url: `/laborer/api/v2/mini/oddJob/collection`,
      method: 'post',
      data
    })
  },
  // 取消收藏零工
  cancelCollect: function (data) {
    return http({
      url: `/laborer/api/v2/mini/oddJob/cancelCollect`,
      method: 'post',
      data
    })
  },
   // 我的-收藏零工列表
   collectionJobList: function (params) {
    return http({
      url: `/laborer/api/v2/mini/oddJob/collection`,
      method: 'get',
      params
    })
  },
  // 用工发布列表
  getUserOddJobt: function (params) {
    return http({
      url: `/laborer/api/v2/mini/oddJob/getUserOddJob`,
      method: 'get',
      params
    })
  },
  // 获取零工分类
  getAllTypes: function (params) {
    return http({
      url: `/laborer/api/v2/mini/oddJob/mini/getAllTypes`,
      method: 'get',
      params
    })
  },
  // 字典
  dictionary: function (type) {
    return http({
      url: `/laborer/api/v2/dictionary`,
      method: 'get',
      params: {type}
    })
  },
  // 新增零工
  addJob: function (data) {
    return http({
      url: `/laborer/api/v2/mini/oddJob/add`,
      method: 'post',
      data
    })
  },
  // 通知列表
  systemMes: function (data) {
    return http({
      url: `/laborer/api/v2/systemMes/mini/list`,
      method: 'post',
      data
    })
  },
   // 劳务派遣
   appeal: function (params) {
    return http({
      url: `/laborer/api/v2/appeal/list`,
      method: 'get',
      params
    })
  },
  // 编辑零工
  editJob: function (id,data) {
    return http({
      url: `/laborer/api/v2/mini/oddJob/update/${id}`,
      method: 'post',
      data
    })
  },
  // 删除零工
  delJob: function (id) {
    return http({
      url: `/laborer/api/v2/mini/oddJob/delete/${id}`,
      method: 'get',
    })
  },
  // 人才列表
  talentList: function (data) {
    return http({
      url: `/laborer/api/v2/mini/Entry/consumerList`,
      method: 'post',
      data
    })
  },
  // 编辑接单方信息
  editConsumer: function (id, data) {
    return http({
      url: `/laborer/api/v2/mini/Entry/editConsumer/${id}`,
      method: 'post',
      data
    })
  },
  // 政策列表
  getPolicyList: function (data) {
    return http({
      url: `/laborer/api/v2/oddJob/policy`,
      method: 'get',
      data
    })
  },
  // 政策详情
  getPolicyInfo: function (id) {
    return http({
      url: `/laborer/api/v2/oddJob/policy/${id}`,
      method: 'get'
    })
  },
  // 获取当前用户的接单入驻信息
  getUserConsumer: function () {
    return http({
      url: `/laborer/api/v2/mini/Entry/getUserConsumer`,
      method: 'get'
    })
  },
  // 接单方入驻
  addConsumer: function (data) {
    return http({
      url: `/laborer/api/v2/mini/Entry/addConsumer`,
      method: 'post',
      data
    })
  },
  // 接单方入驻
  getTalentInfo: function (id) {
    return http({
      url: `/laborer/api/v2/mini/Entry/info/${id}`,
      method: 'get'
    })
  },
  // 在招职位列表
  positionInviteList: function (data) {
    return http({
      url: `/laborer/api/mini/invite/positionInviteList`,
      method: 'get',
      data
    })
  },
  // 根据用户id收藏
  consumerCollect: function (consumerUserId) {
    return http({
      url: `/laborer/api/v2/mini/Entry/collect/${consumerUserId}`,
      method: 'post'
    })
  },
  // 根据userId取消收藏
  consumerCollectCancel: function (consumerUserId) {
    return http({
      url: `/laborer/api/v2/mini/Entry/collectCancel/${consumerUserId}`,
      method: 'post'
    })
  },
  // 根据userId取消收藏
  sendInvite: function (data) {
    return http({
      url: `/laborer/api/mini/invite/sendInvite`,
      method: 'post',
      data
    })
  },
  // 获取零工驿站
  getStage: function (areaCode) {
    return http({
      url: `/laborer/api/v2/oddJob/stage/mini`,
      method: 'get',
      data: {
        areaCode
      }
    })
  },
  // 我的-收藏师傅列表
  collectionList: function (params) {
    return http({
      url: `/laborer/api/v2/mini/Entry/collectionList`,
      method: 'get',
       params
    })
  },
  // 加载聊天室列表
  loadChatRoomList: function (data) {
    return http({
      url: `/laborer/api/chat/loadChatRoomList`,
      method: 'get',
      data
    })
  },
  // 查询未读消息
  checkNewMes: function (data) {
    return http({
      url: `/laborer/api/v2/systemMes/mini/checkNewMes`,
      method: 'get',
      data
    })
  },
  // 更新指定的信息状态为已读
  updateStatus: function (id) {
    return http({
      url: `/laborer/api/v2/systemMes/mini/updateStatus/${id}`,
      method: 'post'
    })
  },
  // 获取发单方信息
  getProviderInfo: function () {
    return http({
      url: `/laborer/api/v2/mini/Entry/providerInfo`,
      method: 'get',
    })
  },
  // 发单方信息编辑
  editProvider: function (data) {
    return http({
      url: `/laborer/api/v2/mini/Entry/editProvider`,
      method: 'post',
      data
    })
  },
  // 发单方信息新增
  addProvider: function (data) {
    return http({
      url: `/laborer/api/v2/mini/Entry/addProvider`,
      method: 'post',
      data
    })
  },
  // 游客登录
  loginByVisitor: function () {
    return http({
      url: `/user/api/v2/wechat/miniapp/login/userid`,
      method: 'post',
      data: {
        userId: config.Config.guestId
      }
    })
  },
  // 雇员实名认证-新增接单方信息
  consumerAuth: function (data) {
    return http({
      url: `/laborer/api/v2/mini/Entry/consumerAuth`,
      method: 'post',
      data
    })
  },
  // 根据userId获取雇员实名认证状态
  getAuthStatus: function () {
    return http({
      url: `/laborer/api/v2/mini/Entry/getAuthStatus`,
      method: 'get',
    })
  },
  // 根据userId获取雇主实名认证状态
  getProviderAuthStatus: function () {
    return http({
      url: `/laborer/api/v2/mini/Entry/getProviderAuthStatus`,
      method: 'get',
    })
  },

  // 根据id切换零工状态
  changeStatus: function (params) {
    return http({
      url: `/laborer/api/v2/mini/oddJob/changeStatus`,
      method: 'get',
      params
    })
  },
  // 接单方或发单方确认工作关系
  confirmRelation: function (data) {
    return http({
      url: `/laborer/api/mini/delivery/confirmRelation`,
      method: 'post',
      data
    })
  },
  // 发单方取消用工关系
  cancelRelation: function (data) {
    return http({
      url: `/laborer/api/mini/delivery/cancelRelation`,
      method: 'post',
      data
    })
  },
  // 发单方取消用工关系
  qryUserEvaluateList: function (data) {
    return http({
      url: `/laborer/api/v2/evaluation/qryUserEvaluateList`,
      method: 'post',
      data
    })
  },
  // 获取评价详情
  getEvaluateInfo: function (params) {
    return http({
      url: `/laborer/api/v2/evaluation/getEvaluateInfo`,
      method: 'get',
      params
    })
  },
  // 评价 type为1 评价岗位,2 评价零工个人
  evaluate: function (data) {
    return http({
      url: `/laborer/api/v2/evaluation/evaluate`,
      method: 'post',
      data
    })
  },
  // 指导价
  getTypeById: function (params) {
    return http({
      url: `/laborer/api/v2/oddJob/jobType/getTypeById`,
      method: 'get',
      params
    })
  },
  // 个人雇主零工岗位列表
  getPersonPosition: function (params) {
    return http({
      url: `/laborer/api/v2/mini/oddJob/getListByUserId`,
      method: 'get',
      params
    })
  },
  // 零工轮播的高薪岗位
  getHighPosition: function (params) {
    return http({
      url: `/laborer/api/v2/mini/oddJob/getHighSalaryJobList`,
      method: 'get',
      params
    })
  },
  // 零工列表的高薪岗位
  attainHighSalaryList: function (data) {
    return http({
      url: `/laborer/api/v2/mini/oddJob/getHighSalaryJobPage`,
      method: 'post',
      data
    })
  },
  // 雇主评价列表
  evaluateEmployeeList: function (data) {
    return http({
      url: `/laborer/api/v2/evaluation/qryEvaluateEmployerDetail`,
      method: 'post',
      data
    })
  },
  // 统计拨打数
  saveUserContactRecord: function (data) {
    return http({
      url: `/laborer/api/v2/mini/oddJob/saveUserContactRecord`,
      method: 'post',
      data
    })
  },
  // 契约卡详情
  qryContractCardDetail: function (params) {
    return http({
      url: `/laborer/api/v2/mini/oddJob/qryContractCardDetail`,
      method: 'get',
      params
    })
  },

  // 零工问卷调查
  insertLaborSubSurvery: function (data) {
    return http({
      url: `/laborer/api/v2/mini/survery/insertLaborSubSurvery`,
      method: 'post',
      data
    })
  },

  // 零工市场用工主体需求调查问卷
  insertLaborSurvery: function (data) {
    return http({
      url: `/laborer/api/v2/mini/survery/insertLaborSurvery`,
      method: 'post',
      data
    })
  },
  
  // 地图找活
  queryMapminiList: function (data) {
    return http({
      url: `/laborer/api/v2/mini/oddJob/queryMapminiList`,
      method: 'post',
      data
    })
  },

  // 地图找工
  queryMapConsumerList: function (data) {
    return http({
      url: `/laborer/api/v2/mini/Entry/queryMapConsumerList`,
      method: 'post',
      data
    })
  },
}



